plot_zoom_png
Rplot02.jpeg
BOX PLOT BLACKS
Rplot01.jpeg

min
1st Q
median
mean
3rd Q
Max
NA's
0
50
70
72.04
85
100
267
summary(blacks)
min
1st Q
median
mean
3rd Q
max
NA's
0
50
70
73
85
100
270
Summary (whiteppl)
nes$V083218b[nes$V083218b=="-1. INAP, 0-12,-8,-9 in Y3"] <- NA

  • nes$V083218b[nes$V083218b=="-8. Don't know"] <- NA

  • nes$V083218b[nes$V083218b=="-9. Refused"] <- NA

  • education<-nes$V083218b

  • summary(blacks)

Min. 1st Qu. Median Mean 3rd Qu. Max. NA's

0.00 50.00 70.00 72.04 85.00 100.00 267

  • summary(christians)

Min. 1st Qu. Median Mean 3rd Qu. Max. NA's

0.00 60.00 85.00 78.55 100.00 100.00 253

  • summary(age)

Min. 1st Qu. Median Mean 3rd Qu. Max. NA's

18.00 33.00 47.00 47.37 59.00 93.00 45

  • boxplot(age)

  • cor(christians, cfundamentals, use="complete.obs")

[1] 0.5477493

  • cor(blacks,whiteppl)

[1] NA

  • cor(blacks, whiteppl, use="complete.obs")

[1] 0.5172538

  • boxplot(blacks)

  • boxplot(blacks)blue

Error: unexpected symbol in "boxplot(blacks)blue"

  • cor(blacks,whiteppl)

[1] NA

  • # Example of a Bagplot

  • library(aplpack)

Error in library(aplpack) : there is no package called ‘aplpack’

  • boxplot(blacks,whiteppl)

  • boxplot(blacks,whiteppl,xlab=votes)

Error in boxplot.default(blacks, whiteppl, xlab = votes) :

object 'votes' not found

  • boxplot(blacks,whiteppl, xlab="votes")

  • violinplot(blacks,whiteppl, xlab="votes, ylab="quantity")

Error: unexpected symbol in "violinplot(blacks,whiteppl, xlab="votes, ylab="quantity"

  • plot(x,y)

Error in plot(x, y) : object 'x' not found

  • #create a scatterplot of Y on X incorporating the custom aesthetic parameters of the plot() function

  • help

function (topic, package = NULL, lib.loc = NULL, verbose = getOption("verbose"),

try.all.packages = getOption("help.try.all.packages"), help_type = getOption("help_type"))
The downloaded binary packages are in

C:\Users\JoshC\AppData\Local\Temp\RtmpWQAked\downloaded_packages

  • library(car) #load it.

Loading required package: MASS

Loading required package: nnet
Attaching package: ‘car’
The following object(s) are masked from ‘package:Hmisc’:
recode
The following object(s) are masked from ‘package:boot’:
logit
  • scatterplot(nes$christians, nes$cfundamentals) #make a fancy scatterplot with

Error in plot.window(...) : need finite 'xlim' values

In addition: Warning messages:

1: In min(x) : no non-missing arguments to min; returning Inf

2: In max(x) : no non-missing arguments to max; returning -Inf

3: In min(x) : no non-missing arguments to min; returning Inf

4: In max(x) : no non-missing arguments to max; returning -Inf

  • #boxplots on the side and lines

  • #of best fit!

>

  • scatterplot(nes$christians, nes$cfundamentals)

Error in plot.window(...) : need finite 'xlim' values

In addition: Warning messages:

1: In min(x) : no non-missing arguments to min; returning Inf

2: In max(x) : no non-missing arguments to max; returning -Inf

3: In min(x) : no non-missing arguments to min; returning Inf

4: In max(x) : no non-missing arguments to max; returning -Inf

  • scatterplot(blacks, whiteppl, 'xlim 10')

  • boxplot(blacks)

  • SUMMARY(BLACKS)

Error: could not find function "SUMMARY"

  • summary(whitppl)

Error in summary(whitppl) : object 'whitppl' not found

  • summary(whiteppl)

Min. 1st Qu. Median Mean 3rd Qu. Max. NA's

0.00 50.00 70.00 73.32 85.00 100.00 270

For this midterm I first had to download the dataset, codebook, and script all to a single folder, labeled “Quantitative Methods”. Then I had to change the directory to this folder and command R to read the data into R, so that it could do all the other commands that were required. I looked at the code book, and decided to focus on blacks and whiteppl. For each variable, I did the commands to generate the summary statistics. Then I did the box plot command to generate a box plot for each variable. This gave me a better understanding of the data. To do the scatterplot I had to download another package which then allowed me to make the command to form a scatter plot of good detail which provided a good visual summary of the two variables.

Box Plots-
a graphic representation of a distribution by a rectangle, the endsof which mark the maximum and minimum values, and in which themedian and first and third quartiles are marked by lines parallel to the ends


Scatter Plot-

A scatter plot is a graph made by plotting ordered pairs in a coordinate plane to show the correlation between two sets of data.
  • A scatter plot describes a positive trend if, as one set of values increases, the other set tends to increase.
  • A scatter plot describes a negative trend if, as one set of values increases, the other set tends to decrease.
  • A scatter plot shows no trend if the ordered pairs show no correlation.